IsThemeActive and dfns->defs
authorRaymond Penners <pennersr@src.gnome.org>
Tue, 7 Oct 2003 18:03:34 +0000 (18:03 +0000)
committerRaymond Penners <pennersr@src.gnome.org>
Tue, 7 Oct 2003 18:03:34 +0000 (18:03 +0000)
modules/engines/ms-windows/ChangeLog.old
modules/engines/ms-windows/xp_theme.c
modules/engines/ms-windows/xp_theme_defs.h [new file with mode: 0644]
modules/engines/ms-windows/xp_theme_dfns.h [deleted file]

index e89efada69f43747f7c4828e6fd99c338a3f0d61..2d85003f5ca351be796d9e1945090e684ee2c510 100755 (executable)
@@ -1,17 +1,31 @@
+2003-10-07  Raymond Penners  <raymond@dotsphinx.com>\r
+\r
+       * src/xp_theme.c: We now properly use IsThemeActive().\r
+       \r
+       * src/xp_theme_defs.h: Renamed from xp_theme_dfns.h\r
+\r
 2003-10-06  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
-       * src/wimp_style_main.c: Catch system settings changes, disable theme and color changes as they're too experimental\r
+       * src/wimp_style_main.c: Catch system settings changes, disable\r
+       theme and color changes as they're too experimental\r
+       \r
        * src/wimp_style.[ch]: Export some things, make them accept 0 args\r
-       * src/xp_theme_dfns.h: New file. WinXP's UXTHEME constants, for building on platforms without them\r
-       * src/xp_theme.c: Should be able to build on Win32 != [WinXP,2k3] now\r
+       \r
+       * src/xp_theme_dfns.h: New file. WinXP's UXTHEME constants, for\r
+       building on platforms without them\r
+       \r
+       * src/xp_theme.c: Should be able to build on Win32 != [WinXP,2k3]\r
+       now\r
        \r
 2003-10-03  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
-       * src/wimp_style.c wimp_style_main.c: Refactor how we're doing styles. Much faster, lower memory consumption\r
+       * src/wimp_style.c wimp_style_main.c: Refactor how we're doing\r
+       styles. Much faster, lower memory consumption\r
        \r
 2003-10-03  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
-       * src/wimp_style_main.c: Catch theme and color changes. Needs more testing and fine-tuning\r
+       * src/wimp_style_main.c: Catch theme and color changes. Needs more\r
+       testing and fine-tuning\r
        \r
 2003-10-02  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
@@ -19,8 +33,9 @@
        \r
 2003-10-01  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
-       * src/wimp_style.c: Only set the delays if the param is installed. Silly gtk - \r
-       installing those 3 params only in the menus...\r
+       * src/wimp_style.c: Only set the delays if the param is\r
+       installed. Silly gtk - installing those 3 params only in the\r
+       menus...\r
 \r
 2003-09-25  Dom Lachowicz <cinamod@hotmail.com>\r
 \r
index 190a429b550011ab378a89b032527c06b6a445c5..e4aacf911b8aa368eaafdd2085125ec1355eb667 100755 (executable)
@@ -31,7 +31,7 @@
 
 /* MS defines this when it includes its schema definitions */
 #ifndef TMSCHEMA_H
-#include "xp_theme_dfns.h"
+#include "xp_theme_defs.h"
 #endif
 
 static const LPCWSTR class_descriptors[] =
@@ -109,12 +109,14 @@ typedef HRESULT (FAR PASCAL *DrawThemeBackgroundFunc)
      (HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
       const RECT *pRect, const RECT *pClipRect);
 typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc)(HWND hwnd, DWORD dwFlags);
+typedef BOOL (FAR PASCAL *IsThemeActiveFunc)(VOID);
 
 static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
 static OpenThemeDataFunc open_theme_data_func = NULL;
 static CloseThemeDataFunc close_theme_data_func = NULL;
 static DrawThemeBackgroundFunc draw_theme_background_func = NULL;
 static EnableThemeDialogTextureFunc enable_theme_dialog_texture_func = NULL;
+static IsThemeActiveFunc is_theme_active_func = NULL;
 
 void
 xp_theme_init(void)
@@ -125,6 +127,7 @@ xp_theme_init(void)
   uxtheme_dll = LoadLibrary("uxtheme.dll");
   memset(open_themes, 0, sizeof(open_themes));
 
+  is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
   open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
   close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
   draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
@@ -137,7 +140,7 @@ xp_theme_exit(void)
 {
   int i;
 
-  if(!uxtheme_dll)
+  if (! uxtheme_dll)
     return;
 
   for (i=0; i < XP_THEME_CLASS__SIZEOF; i++)
@@ -152,6 +155,7 @@ xp_theme_exit(void)
   FreeLibrary(uxtheme_dll);
   uxtheme_dll = NULL;
 
+  is_theme_active_func = NULL;
   open_theme_data_func = NULL;
   close_theme_data_func = NULL;
   draw_theme_background_func = NULL;
@@ -642,7 +646,7 @@ xp_theme_draw(GdkWindow *win, XpThemeElement element, GtkStyle *style,
 gboolean
 xp_theme_is_drawable(XpThemeElement element)
 {
-  if (uxtheme_dll)
+  if (is_theme_active_func && (*is_theme_active_func)())
     {
       return (xp_theme_get_handle_by_element(element) != NULL);
     }
diff --git a/modules/engines/ms-windows/xp_theme_defs.h b/modules/engines/ms-windows/xp_theme_defs.h
new file mode 100644 (file)
index 0000000..de449cb
--- /dev/null
@@ -0,0 +1,152 @@
+/* Wimp "Windows Impersonator" Engine
+ *
+ * Copyright (C) 2003 Dom Lachowicz <cinamod@hotmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * These are the real values of these UXTHEME constants, provided so that we can 
+ * compile/link on Win32 platforms that aren't WinXP, and also build against
+ * MinGW 1.0/1.1, which also doesn't have these things defined in its header files
+ */
+
+#ifndef XP_THEME_DFNS_H
+#define XP_THEME_DFNS_H
+
+#define BP_PUSHBUTTON 1
+#define BP_CHECKBOX 3
+
+#define HP_HEADERITEM 1
+
+#define CP_DROPDOWNBUTTON 1
+
+#define TABP_TABITEM 1
+#define TABP_TABITEMLEFTEDGE 2
+#define TABP_PANE 9
+#define TABP_BODY 10
+
+#define SBP_ARROWBTN 1
+#define SBP_THUMBBTNHORZ 2
+#define SBP_THUMBBTNVERT 3
+#define SBP_LOWERTRACKHORZ 5
+#define SBP_LOWERTRACKVERT 6
+#define SBP_GRIPPERHORZ 8
+#define SBP_GRIPPERVERT 9
+
+#define EP_EDITTEXT 1
+
+#define SPNP_UP 1
+#define SPNP_DOWN 2
+
+#define BP_RADIOBUTTON 2
+
+#define TVP_GLYPH 2
+
+#define PP_BAR 1
+#define PP_BARVERT 2
+#define PP_CHUNK 3
+#define PP_CHUNKVERT 4
+
+#define TTP_STANDARD 1
+
+#define RP_GRIPPER 1
+#define RP_GRIPPERVERT 2
+#define RP_BAND 3
+#define RP_CHEVRON 4
+
+#define TP_BUTTON 1
+
+#define TTSS_NORMAL 1
+
+#define CHEVS_NORMAL 1
+#define CHEVS_HOT 2
+#define CHEVS_PRESSED 3
+
+#define TIS_NORMAL 1
+#define TIS_HOT 2
+#define TIS_SELECTED 3
+#define TIS_DISABLED 4
+
+#define ETS_NORMAL 1
+#define ETS_FOCUSED 5
+#define ETS_READONLY 6
+
+#define SCRBS_NORMAL 1
+#define SCRBS_HOT 2
+#define SCRBS_PRESSED 3
+#define SCRBS_DISABLED 4
+
+#define ABS_UPNORMAL 1
+#define ABS_UPHOT 2
+#define ABS_UPPRESSED 3
+#define ABS_UPDISABLED 4
+#define ABS_DOWNNORMAL 5
+#define ABS_DOWNHOT 6
+#define ABS_DOWNDISABLED 8
+#define ABS_LEFTNORMAL 9
+#define ABS_LEFTHOT 10
+#define ABS_LEFTPRESSED 11
+#define ABS_LEFTDISABLED 12
+#define ABS_RIGHTNORMAL 13
+#define ABS_RIGHTHOT 14
+#define ABS_RIGHTPRESSED 15
+#define ABS_RIGHTDISABLED 16
+
+#define CBS_UNCHECKEDNORMAL 1
+#define CBS_UNCHECKEDHOT 2
+#define CBS_UNCHECKEDPRESSED 3
+#define CBS_UNCHECKEDDISABLED 4
+#define CBS_CHECKEDNORMAL 5
+#define CBS_CHECKEDHOT 6
+#define CBS_CHECKEDPRESSED 7
+#define CBS_CHECKEDDISABLED 8
+
+#define PBS_NORMAL 1
+#define PBS_HOT 2
+#define PBS_PRESSED 3
+#define PBS_DISABLED 4
+#define PBS_DEFAULTED 5
+
+#define DNS_NORMAL 1
+#define DNS_HOT 2
+#define DNS_PRESSED 3
+#define DNS_DISABLED 4
+
+#define UPS_NORMAL 1
+#define UPS_HOT 2
+#define UPS_PRESSED 3
+#define UPS_DISABLED 4
+
+#define GLPS_OPENED 1
+#define GLPS_CLOSED 2
+
+#if UXTHEME_HAS_LINES
+
+#error unknown/undocumented uxtheme values
+
+/* #define GP_LINEHORZ */
+/* #define GP_LINEVERT */
+/* #define LHS_RAISED */
+/* #define LHS_SUNKEN */
+/* #define LHS_FLAT */
+/* #define LVS_RAISED */
+/* #define LVS_SUNKEN */
+/* #define LHS_FLAT */
+
+#endif /* UXTHEME_HAS_LINES */
+
+#endif /* XP_THEME_DFNS_H */
diff --git a/modules/engines/ms-windows/xp_theme_dfns.h b/modules/engines/ms-windows/xp_theme_dfns.h
deleted file mode 100644 (file)
index de449cb..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Wimp "Windows Impersonator" Engine
- *
- * Copyright (C) 2003 Dom Lachowicz <cinamod@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * These are the real values of these UXTHEME constants, provided so that we can 
- * compile/link on Win32 platforms that aren't WinXP, and also build against
- * MinGW 1.0/1.1, which also doesn't have these things defined in its header files
- */
-
-#ifndef XP_THEME_DFNS_H
-#define XP_THEME_DFNS_H
-
-#define BP_PUSHBUTTON 1
-#define BP_CHECKBOX 3
-
-#define HP_HEADERITEM 1
-
-#define CP_DROPDOWNBUTTON 1
-
-#define TABP_TABITEM 1
-#define TABP_TABITEMLEFTEDGE 2
-#define TABP_PANE 9
-#define TABP_BODY 10
-
-#define SBP_ARROWBTN 1
-#define SBP_THUMBBTNHORZ 2
-#define SBP_THUMBBTNVERT 3
-#define SBP_LOWERTRACKHORZ 5
-#define SBP_LOWERTRACKVERT 6
-#define SBP_GRIPPERHORZ 8
-#define SBP_GRIPPERVERT 9
-
-#define EP_EDITTEXT 1
-
-#define SPNP_UP 1
-#define SPNP_DOWN 2
-
-#define BP_RADIOBUTTON 2
-
-#define TVP_GLYPH 2
-
-#define PP_BAR 1
-#define PP_BARVERT 2
-#define PP_CHUNK 3
-#define PP_CHUNKVERT 4
-
-#define TTP_STANDARD 1
-
-#define RP_GRIPPER 1
-#define RP_GRIPPERVERT 2
-#define RP_BAND 3
-#define RP_CHEVRON 4
-
-#define TP_BUTTON 1
-
-#define TTSS_NORMAL 1
-
-#define CHEVS_NORMAL 1
-#define CHEVS_HOT 2
-#define CHEVS_PRESSED 3
-
-#define TIS_NORMAL 1
-#define TIS_HOT 2
-#define TIS_SELECTED 3
-#define TIS_DISABLED 4
-
-#define ETS_NORMAL 1
-#define ETS_FOCUSED 5
-#define ETS_READONLY 6
-
-#define SCRBS_NORMAL 1
-#define SCRBS_HOT 2
-#define SCRBS_PRESSED 3
-#define SCRBS_DISABLED 4
-
-#define ABS_UPNORMAL 1
-#define ABS_UPHOT 2
-#define ABS_UPPRESSED 3
-#define ABS_UPDISABLED 4
-#define ABS_DOWNNORMAL 5
-#define ABS_DOWNHOT 6
-#define ABS_DOWNDISABLED 8
-#define ABS_LEFTNORMAL 9
-#define ABS_LEFTHOT 10
-#define ABS_LEFTPRESSED 11
-#define ABS_LEFTDISABLED 12
-#define ABS_RIGHTNORMAL 13
-#define ABS_RIGHTHOT 14
-#define ABS_RIGHTPRESSED 15
-#define ABS_RIGHTDISABLED 16
-
-#define CBS_UNCHECKEDNORMAL 1
-#define CBS_UNCHECKEDHOT 2
-#define CBS_UNCHECKEDPRESSED 3
-#define CBS_UNCHECKEDDISABLED 4
-#define CBS_CHECKEDNORMAL 5
-#define CBS_CHECKEDHOT 6
-#define CBS_CHECKEDPRESSED 7
-#define CBS_CHECKEDDISABLED 8
-
-#define PBS_NORMAL 1
-#define PBS_HOT 2
-#define PBS_PRESSED 3
-#define PBS_DISABLED 4
-#define PBS_DEFAULTED 5
-
-#define DNS_NORMAL 1
-#define DNS_HOT 2
-#define DNS_PRESSED 3
-#define DNS_DISABLED 4
-
-#define UPS_NORMAL 1
-#define UPS_HOT 2
-#define UPS_PRESSED 3
-#define UPS_DISABLED 4
-
-#define GLPS_OPENED 1
-#define GLPS_CLOSED 2
-
-#if UXTHEME_HAS_LINES
-
-#error unknown/undocumented uxtheme values
-
-/* #define GP_LINEHORZ */
-/* #define GP_LINEVERT */
-/* #define LHS_RAISED */
-/* #define LHS_SUNKEN */
-/* #define LHS_FLAT */
-/* #define LVS_RAISED */
-/* #define LVS_SUNKEN */
-/* #define LHS_FLAT */
-
-#endif /* UXTHEME_HAS_LINES */
-
-#endif /* XP_THEME_DFNS_H */